package com.dotndot.momserver.response;

import java.util.*;

import com.dotndot.momserver.data.*;

public class ResDiary
{
    private int category;
    private Date date;
    private Sleep sleep = null;
    private Nappy nappy = null;
    private Food food = null;
    private Hospital hospital = null;

    public ResDiary(int category, Date date, Object item){
        this.category = category;
        this.date = date;
        setItem(item);
    }
    
    private void setItem(Object item){
        switch(this.category){
            case Diary.CATEGORY_SLEEP:
                if(item instanceof Sleep){
                    this.sleep = ((Sleep) item);
                }
                break;
            case Diary.CATEGORY_NAPPY:
                if(item instanceof Nappy){
                    this.nappy = ((Nappy) item);
                }
                break;
            case Diary.CATEGORY_FOOD:
                if(item instanceof Food){
                    this.food = ((Food) item);
                }
                break;
            case Diary.CATEGORY_HOSPITAL:
                if(item instanceof Hospital){
                    this.hospital = ((Hospital) item);
                }
                break;
        }
    }
}
